package pl.ptemich.bumbastic;




public class FlatOrientationHex {// extends AbstractHex {

    double circle;
    
    boolean selected = false;
    
    private int x;
    
    private int y;
    
    private int side;
    
    private Point[] vertexes;  
    
    public FlatOrientationHex(int side, double x, double y) {
        this(side, Double.valueOf(x).intValue(), Double.valueOf(y).intValue());
    }
    
    public FlatOrientationHex(int side, int x, int y) {
        this.x = x;
        this.y = y;
        this.side = side;
        
        double h = AbstractHex.calculateH(side);
        double r = AbstractHex.calculateR(side);
        
        circle = Math.sqrt((x * x) + (y * y));
        
        vertexes = new Point[6];
        vertexes[0] = new Point(x - (side / 2), y - r);
        vertexes[1] = new Point(x + (side / 2), y - r);
        vertexes[2] = new Point(x + (side / 2) + h, y);
        vertexes[3] = new Point(x + (side / 2), y + r);
        vertexes[4] = new Point(x - (side / 2), y + r);
        vertexes[5] = new Point(x - (side / 2) - h, y);
    }
    

    public double getCircle() {
        return circle;
    }

    public boolean checkSelected(int mouseX, int mouseY) {
        selected = false;
        if (mouseX > x - (side / 2) && mouseX < x + (side / 2)) {
            if (mouseY > y - (side / 2) && mouseY < y + (side / 2)) {
                selected = true;
            }              
        }     
        return selected;
    }

    
    
}
